/*
 * @Author: life 2145887855@qq.com
 * @Date: 2025-05-21 13:30:18
 * @LastEditors: life 2145887855@qq.com
 * @LastEditTime: 2025-05-28 10:22:11
 * @FilePath: \vue2024\src\api\good\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios, { AxiosResponse } from 'axios';
export interface getGoodsReqVO {
    goodsId: number;
    goodsName: string; // 商品名称
    price: number; // 商品价格
    introduction: string; // 商品简介
 
}

export interface getOrderReqVO {
    goodsId: number;
    userId: string; // 商品名称
    price: number; // 商品价格
    orderTime: String; // 商品简介
 
}

export interface getCollectReqVO {
    goodsId: number;
    userId: string; // 商品名称

 
}
export const getGoods = {
//商品查询
getGoodsApi: async (params: getGoodsReqVO): Promise<AxiosResponse> => {
    return await axios.post('http://localhost:48080/app-api/app/good/page',params);
},
// 使用封装的请求函数
getGoodsByIdApi: async (params: getGoodsReqVO) => {
    return await axios.post('http://localhost:48080/app-api/app/good/get',params);
},
//商品下单
orderGoodsApi: async (params: getOrderReqVO) => {
    return await axios.post('http://localhost:48080/app-api/appOrder/orders/create',params);
},
// 获得订单信息（保持GET请求，修正URL和参数传递方式）
getOrderApi: async (params: getCollectReqVO) => {
    return await axios.post('http://localhost:48080/app-api/appOrder/orders/page', params);{
    
    }}, 
//商品收藏
collectGoodsApi: async (params: getCollectReqVO) => {
    return await axios.post('http://localhost:48080/app-api/appfavorites/favorites/create',params);
},
//商品收藏
getCollectGoodsApi: async (params: getCollectReqVO) => {
    return await axios.post('http://localhost:48080/app-api/appfavorites/favorites/page',params);
},
//取消收藏
DeleteCollectGoodsApi: async (params: getCollectReqVO) => {
    return await axios.post('http://localhost:48080/app-api/appfavorites/favorites/delete',params);
},
}